﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using DomainDriver.DomainModeling.DomainObjects;

namespace DomainDriver.DomainModeling.Example.DomainObjects
{
    public class DummyDomainObjectRelation : DomainObjectBase<DummyDomainObjectRelation>
    {
        private Guid m_ParentId;
        private Guid m_ChildId;

        public DummyDomainObjectRelation()
            : this(Guid.Empty, Guid.Empty)
        { }

        public DummyDomainObjectRelation(Guid parentId, Guid childId)
        {
            m_ParentId = parentId;
            m_ChildId = childId;
        }

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Column(Order = 0)]
        public Guid ParentId
        {
            get { return m_ParentId; }
            set { m_ParentId = value; }
        }

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Column(Order = 1)]
        public Guid ChildId
        {
            get { return m_ChildId; }
            set { m_ChildId = value; }
        }

        #region DomainObject Methods

        public override DummyDomainObjectRelation Copy()
        {
            DummyDomainObjectRelation newObject = new DummyDomainObjectRelation();
            CopyTo(newObject);
            return newObject;
        }

        public override void CopyTo(DummyDomainObjectRelation otherObject)
        {
            otherObject.m_ParentId = m_ParentId;
            otherObject.m_ChildId = m_ChildId;
        }

        public override bool Equals(DummyDomainObjectRelation otherObject)
        {
            if (otherObject.m_ParentId != m_ParentId)
            { return false; }
            if (otherObject.m_ChildId != m_ChildId)
            { return false; }
            return true;
        }

        #endregion
    }
}